package com.example.utils;

import java.util.Random;

public class SaltUtil {

    /**
     * 生成salt的静态方法
     * @param n
     * @return
     */
    public static String getSalt(int n){
        char[] chars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()".toCharArray();
        StringBuilder sb=new StringBuilder();
        for (int i = 0; i < n; i++) {
            char a=chars[new Random().nextInt(chars.length)];
            sb.append(a);
        }
        return sb.toString();
    }


}
